<template>
  <div class="header">
    <div class="platform">
      <div class="logo">
        <img :src="platform.logo">
      </div>
      <span> {{ platform.name }} </span>
    </div>
    <div class="userinfo">
      <el-dropdown trigger="hover">
        <span class="el-dropdown-link userinfo-inner"><img :src="user.portrait" /> {{ user.name}}</span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>我的消息</el-dropdown-item>
          <el-dropdown-item>设置</el-dropdown-item>
          <el-dropdown-item divided @click.native="logout">退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>
<script>
export default {
  name: 'header',
  props: {
    platform: {
      type: Object,
      default: () => {
        return {
          logo: '../../static/logo/fjrcloud.png',
          name: '福建融云物联网科技有限公司'
        }
      }
    },
    user: {
      type: Object,
      default: () => {
        return {
          portrait: '',
          name: ''
        }
      }
    }
  }
}
</script>
<style lang='less'>
@import '../assets/css/base.less';

.header {
  height: 70px;
  line-height: 70px;
  background: @theme-color;
  color: #ffffff;
  font-size: 19px;
  padding: 0 15px;

  .platform {
    display: inline-block;
    .logo {
      display: inline-block;
      img {
        vertical-align: middle;
      }
    }
  }

  .userinfo {
    text-align: right;
    float: right;
    .userinfo-inner {
      cursor: pointer;
      color: #f9fafb;
      font-size: 15px;
      img {
        width: 47px;
        height: 47px;
        border-radius: 50%;
        margin: 10px 0px 10px 10px;
        float: right;
      }
    }
  }
}
</style>
